// 递归方式解题
function Fibonacci1(num) {
    return n <= 1 ? n : fib(n - 2) + fib(n - 1)
}
console.log('递归方式解决斐波那契数列 => ', Fibonacci1(10));

// 动态规划方式解题
function Fibonacci2(num) {
    if (num < 2) {
        return num
    }
    let p = 0, q = 0, r = 1
    for (let i=2;i<=num;i++) {
        p = q
        q = r
        r = p + q
    }
    return r
}
console.log('循环方式解决斐波那契数列 => ', Fibonacci1(10));
